
<?php
    header('content-type:text/html;charset=utf-8');
    if(isset($_POST['button'])):
        $color=$_POST['color'];
        switch($color):
            case '1':
                $color='#ff0000';
                break;
             case '2':
                $color='#009900';
                break;
             case'3':
                $color='#ooooff';
                break;
         endswitch;
        ?>
        <script type="text/javascript">
        window.onload=function(){
            shi.style.color="<?php echo $color?>";
        }
        </script>
<?php
       endif;
?>
<div id="shi" class="">
    锄禾日当午，<br />
    汗滴禾下土。<br />
    谁知盘中餐，<br />
    粒粒皆辛苦。<br />
</div>
<form method="post" action="">
    <select name="color">
        <option value="">----请选择颜色---</option>
        <option value="1">红色</option>
        <option value="2">绿色</option>
        <option value="3">蓝色</option>
    </select><br  />
    <input type="submit" name="button" value="更改颜色">
</form>




